package com.szxy.hotel.service;

import com.szxy.hotel.entity.Client;
import com.szxy.hotel.entity.Commodity;
import com.szxy.hotel.entity.Consume;
import com.szxy.hotel.mapper.ClientMapper;
import com.szxy.hotel.mapper.CommodityMapper;
import com.szxy.hotel.mapper.ConsumeMapper;
import com.szxy.hotel.mapper.RoomMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("guestroomService")
public class GuestroomService {
    @Resource
    CommodityMapper commodityMapper;
    @Resource
    ConsumeMapper consumeMapper;
    @Resource
    RoomMapper roomMapper;
    @Resource
    ClientMapper clientMapper;
    public Commodity selectConsume(String id) {
        return commodityMapper.selectConsume(id);
    }

    public int insertConsume(Consume consume) {
        return consumeMapper.insertConsume(consume);
    }

    public List<Consume> findByPage(int start, int size) {
        return consumeMapper.findByPage(start,size);
    }

    public List<Consume> selectCount() {
        return consumeMapper.selectCount();
    }

    public List<Consume> findByPage1(int start, int size, String selectroomid) {
        return consumeMapper.findByPage1(start,size,selectroomid);
    }

    public List<Consume> selectCount1(String selectroomid) {
        return consumeMapper.selectCount1(selectroomid);
    }

    public int updateDate(String outRoomTime, int roomtime, String roomid) {
        return roomMapper.updateRoomDate(outRoomTime,roomtime,roomid);
    }

    public Client findByUsername(String roomName) {
        return clientMapper.findByclientname(roomName);
    }

    public void updateClientMoney(Double money, String roomName) {
        clientMapper.updateClient(roomName,money);
    }
}
